
/**
 *  Welcome to your gulpfile!
 *  The gulp tasks are split into several files in the gulp directory
 *  because putting it all here was too long
 */

'use strict';

var fs = require('fs');
var gulp = require('gulp');

/**
 *  This will load all js or coffee files in the gulp directory
 *  in order to load all gulp tasks
 */
fs.readdirSync('./gulp').filter(function(file) {
  return (/\.(js|coffee)$/i).test(file);
}).map(function(file) {
  require('./gulp/' + file);
});


/**
 *  Default task clean temporaries directories and launch the
 *  main optimization build task
 */
gulp.task('default', ['clean'], function () {
  gulp.start('build');
});


/*启动本地服务*/
// gulp.task('serve', ['develop', 'connect']);
//
// gulp.task('inject-deps', ['prep-css', 'prep-js'], function(){
//
//   gulp.task('prep-js',['clean'], function(){
//     var jspath = './src/page/**/*.js';
//     var treatJs = gulp.src(jspath)
//       .pipe(plugins.concat('scripts.js'))
//       .pipe(plugins.uglify())
//       .pipe(gulp.dest('.tmp/page/js'))
//   });
//
//   //select main bower files
//   var bowerDep = gulp.src(plugins.mainBowerFiles(), {read: false});
//   //inject files
//   return  gulp.src('./src/index.html')
//     .pipe(plugins.inject(bowerDep, {relative: true, name:'bower'}))
//     .pipe(plugins.inject(gulp.src('.tmp/page/js/*.js'), {name:'frontjs'}))
//     .pipe(plugins.inject(gulp.src('.tmp/page/css/*.css'), {name:'frontcss'}))
//     .pipe(gulp.dest('.tmp/page'));
// });
//
//
// /*打包，启动生产服务*/
// gulp.task('serve', ['watch']);
